<head th:fragment="header">
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>到家产品管理系统</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="/favicon.ico">
	<link href="css/bootstrap.min.css?v=3.3.6"
		  th:href="@{/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet">
	<link href="/css/font-awesome.css?v=4.4.0"
		  th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet">
	<link href="/css/plugins/bootstrap-table/bootstrap-table.min.css"
		  th:href="@{/css/plugins/bootstrap-table/bootstrap-table.min.css}"
		  rel="stylesheet">
	<link href="/css/plugins/jsTree/style.min.css" rel="stylesheet">
	<link href="/css/plugins/bootstrap-select/bootstrap-select.css" rel="stylesheet">
	<link href="/css/plugins/jqTreeGrid/jquery.treegrid.css"
		  rel="stylesheet">
	<!--summernote css -->
	<link href="/css/plugins/summernote/summernote-0.8.8.css"
		  rel="stylesheet">
	<link href="css/animate.css" th:href="@{/css/animate.css}"
		  rel="stylesheet">
	<link href="/css/plugins/chosen/chosen.css" rel="stylesheet">
	<link href="/css/style.css?v=4.1.0" th:href="@{/css/style.css?v=4.1.0}"
		  rel="stylesheet">
	<link rel="stylesheet" href="/css/selectpage.css" type="text/css">
	<link rel="stylesheet" href="/js/layui-v2.6.6/layui/css/layui.css">
	<style>
		.required::after{
			content: "*";
			color: red;
			position: absolute;
			bottom: 1px;
		}
		#btnUpload{
			margin-top: 10px;
		}
		.layui-upload-file {
			display: none!important;
			opacity: .01;
			filter: Alpha(opacity=1);
		}
		.layui-table-cell{
			padding: 0 !important;
		}
		.mt2{
			margin: 0!important;
			padding-top: 10px!important;
			height: 100%!important;

		}
		.layui-table-view{
			height: calc(100% - 100px);
		}
		.layui-table-box{
			height: calc(100% - 40px);
		}
		.layui-table-page{
			height: 40px!important;
			display: flex;
			align-items: center;
			justify-content: flex-end;
			padding-right: 20px!important;
		}
		.layui-table-body{
			width: 100%;
			height: calc(100% - 40px);
		}

		div[lay-id="exampleTable"]>.layui-table-box>.layui-table-header {
			z-index: 2;
		}
		.layui-table-header{
			position: sticky;
			top: 0;
			z-index: 1;
			height: 40px;
		}

	/*	loading */
		.loading-container {
			position: fixed;
			top: 0;
			width: 100%;
			height: 100%;
			z-index:-999;
		}

		.loading-overlay {
			position: absolute;
			top: 0;
			left: 0;
			width: 100%;
			height: 100%;
			background: rgba(255, 255, 255, 0.5);
			z-index: 1000;
			display: none;
		}

		.loading-show .loading-overlay {
			display: block;
		}

		.loading-spinner {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			width: 50px;
			height: 50px;
			border: 3px solid #f3f3f3;
			border-top: 3px solid #3498db;
			border-radius: 50%;
			animation: spin 1s linear infinite;
			z-index: 1001;
			display: none;
		}

		.loading-show .loading-spinner {
			display: block;
		}

		@keyframes spin {
			0% { transform: rotate(0deg); }
			100% { transform: rotate(360deg); }
		}
	/*	SBlayui表格显示不对*/
		table>tbody>tr>td>div{
			display: flex !important;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;
		}
		table>tbody>tr>td[colspan="12"]>div{
			display: block !important;
		}
		.layui-table-cell{
			min-height: 36px;
		}
		.layui-table-cell>span{
			white-space: nowrap; /* 自适应宽度*/overflow:hidden;text-overflow:ellipsis;
			margin-left: 2px;
		}
		table>tbody>tr>td>div>a{
			margin-right: 2px;
		}
		.layui-table-grid-down {
			display: none!important;
		}
		.myi{
			position: absolute; right: 30px;  top: 30%;
		}
		.myi:hover{
			cursor: pointer;
		}
		/**颜色设置	 */
		.layui-table-init{
			background-color: hsla(0,0%,100%,.9);
		}
		.layui-table-init .layui-icon {
			font-size: 100px;
			color: #409eff;

		}
		img:hover{
			cursor: pointer;
		}
		.layui-icon-clear,.layui-table-loading,.layui-layer-loading{
			display: none!important;
		}
	</style>
</head>
<div th:fragment="footer">
	<div id="loadingContainer" class="loading-container">
		<div class="loading-overlay"></div>
		<div class="loading-spinner"></div>
	</div>
	<script src="/js/jquery.min.js?v=2.2.4"></script>
<!--	<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>-->
<!--	<script src="https://cdn.bootcdn.net/ajax/libs/jquery/2.2.4/jquery.min.js"></script>-->
	<script src="/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
	<script src="/js/plugins/bootstrap-select/bootstrap-select.js"></script>
	<script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
	<script src="/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="/js/plugins/validate/jquery.validate.extend.js"></script>
	<script src="/js/plugins/validate/messages_zh.min.js"></script>
	<script src="/js/plugins/jsTree/jstree.min.js"></script>
	<script src="/js/plugins/jqTreeGrid/jquery.treegrid.min.js"></script>
	<script src="/js/plugins/jqTreeGrid/jquery.treegrid.extension.js"></script>
	<script src="/js/plugins/jqTreeGrid/jquery.treegrid.bootstrap3.js"></script>
	<script src="/js/plugins/chosen/chosen.jquery.js"></script>
	<script src="/js/plugins/layer/layer.js"></script>
	<script src="/js/layui-v2.6.6/layui/layui.js"></script>
	<script src="/js/content.js?v=1.0.0"></script>
	<!--summernote-->
	<script src="/js/plugins/summernote/summernote.js"></script>
	<script src="/js/plugins/summernote/summernote-zh-CN.min.js"></script>
	<!--分页下拉框-->
	<script type="text/javascript" src="/js/selectpage.js" ></script>
	<script type="text/javascript" src="/js/jquery-form.js"></script>
	<script src="/js/plugins/echarts/echarts-all.js"></script>
	<script>
		function getIpAndAddres(){
			let IpAndAddres = localStorage.getItem("IpAndAddres");
			IpAndAddres=IpAndAddres ? JSON.parse(IpAndAddres) : null
			const _setAjax=()=>{
				$.ajaxSetup({
					headers: {
						'Ip': IpAndAddres.ip,
						'Addres': encodeURIComponent(IpAndAddres.addres)
					},
					//发送请求前触发
					beforeSend: function (xhr) {
						showLoading();
					},
					complete: function (xhr, status) {hindLoading()},
				})
			}
			if(IpAndAddres==null){
				$.getJSON('https://qifu-api.baidubce.com/ip/local/geo/v1/district', function(data) {
					IpAndAddres={}
					IpAndAddres.ip=data.ip
					IpAndAddres.addres=data.data.prov+data.data.city+data.data.district
					localStorage.setItem("IpAndAddres",JSON.stringify(IpAndAddres));
					_setAjax()
					console.log('请求得到设置',IpAndAddres)
				});
			}else{
				_setAjax()
			}
		}
		getIpAndAddres()
		function showLoading(){
			let myIframe=window.parent.document.getElementsByClassName('J_iframe')
			let itemFrame,div
			for (let i = 0; i < myIframe.length; i++) {
				if($(myIframe[i]).css('display')!='none'){
					itemFrame=myIframe[i]
				}
			}
			if(itemFrame&&itemFrame.contentWindow&& itemFrame.contentWindow.document) {
				div = itemFrame.contentWindow.document.getElementById('loadingContainer')
			}else{
				div=$("#loadingContainer")
			}
			//获取目前显示的
			$(div).addClass('loading-show');
			$(div).css('z-index',999999999999999);
		}
		function hindLoading(){
			let myIframe=window.parent.document.getElementsByClassName('J_iframe')
			let itemFrame,div
			for (let i = 0; i < myIframe.length; i++) {
				if($(myIframe[i]).css('display')!='none'){
					itemFrame=myIframe[i]
				}
			}
			if(itemFrame&&itemFrame.contentWindow&& itemFrame.contentWindow.document){
				div=itemFrame.contentWindow.document.getElementById('loadingContainer')
			}else{
				div=$("#loadingContainer")
			}
			$(div).css('z-index',-999);
			$(div).removeClass('loading-show');
			setSpanText()
		}
		function restrictInput(event) {
			// 获取输入框元素
			var input = event.target;
			// 获取输入的值
			var inputValue = input.value;
			input.value = inputValue.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1');
		}

		var tip_index;
		/**
		 * 页面表格内容超出宽度显示...
		 * 鼠标放上去之后回显具体内容
		 * 移开鼠标内容消失
		 */
		function showAndHideMsg(){
			//.contains()
			$(document).on("mouseenter","td",function(){
				//去掉一些特殊的
				if($(this).find('input').length>0||$(this).find('a').length>0){
					return false
				}
				if(tip_index){
					layui.use('layer', function(layer) {
						layer.close(tip_index);
						tip_index=null;
					});
				}
				let text = $(this).text();
				const checkEllipsis = (box) => {
					const range = document.createRange();
					range.setStart(box, 0);
					range.setEnd(box, box.childNodes.length);
					window.getSelection().addRange(range);
					const rangeWidth = range.getBoundingClientRect().width; // 所有文字的宽度
					const rangeHeight = range.getBoundingClientRect().height; // 所有文字的高度
					// console.log(rangeWidth, rangeHeight);
					const getPadding = (el) => {
						const style = window.getComputedStyle(el, null);
						const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
						const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
						const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
						const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
						return {
							pLeft: paddingLeft,
							pRight: paddingRight,
							pTop: paddingTop,
							pBottom: paddingBottom,
						};
					}
					const { pLeft, pRight, pTop, pBottom } = getPadding(box);
					// console.log(pLeft, pRight, pTop, pBottom, "--");
					const horizontalPadding = pLeft + pRight;
					const verticalPadding = pTop + pBottom;
					if (
							rangeWidth + horizontalPadding > box.offsetWidth ||
							rangeHeight + verticalPadding > box.offsetHeight ||
							range.scrollWidth > box.offsetWidth
					) {
						window.getSelection().removeRange(range)
						// console.log("计算结果：存在省略号")
						return true
					} else {
						window.getSelection().removeRange(range)
						// console.log("计算结果：容器宽度足够，没有省略号了")
						return false
					}
				};


				// &&this.offsetWidth < this.scrollWidth
				if (text.trim()!='' && (checkEllipsis($(this)[0])||$(this).find('div[class=myHTml]').length>0)) {
					let that = this;
					let wid;

					if(text.length>1000){
						wid = '900px';
					}else if(text.length>600){
						wid = '700px';
					}else if(text.length>150){
						wid = '500px';
					}else if(text.length>100){
						wid = '250px';
					}else if(text.length>50){
						wid = '150px';
					}
					layui.use('layer', function(layer) {
						tip_index = layer.tips('<span style="word-wrap: break-word;">'+text+'</span>', that, {
							tips: [4, "#000000"],
							time: 0,
							area: [wid, 'auto']
						});
					});
				}
			});
			$(document).on("mouseout","td",function(){
				//判断是否有span
				if($(this).find('span').length==0 && $(this).find('div[class=myHTml]').length==0){
					 if(tip_index) {
						layui.use('layer', function (layer) {
							layer.close(tip_index);
							tip_index=null
						});
					}
				}
			});
			$(document).on("mouseout","td>div",function(){
				//判断是否有span
				if($(this).find('span').length==0 && $(this).find('div[class=myHTml]').length==0){
					if(tip_index) {
						layui.use('layer', function (layer) {
							layer.close(tip_index);
							tip_index=null
						});
					}
				}
			});
			$(document).on("mouseout","td>div>span",function(){
				if(tip_index){
					layui.use('layer', function(layer) {
						layer.close(tip_index);
						tip_index=null
					});
				}
			});
		}
		showAndHideMsg()
		function setSpanText(){
			//补充span并且设置为-
			for (let i = 0; i < $('td>div').length; i++) {
				let isSpan=$('td>div')[i]
				//判断里面有没有span
				if(isSpan.children.length==0){
					let myTitles=isSpan.innerText
					myTitles=(myTitles==''||myTitles=='null'||myTitles==null)?'-':myTitles
					//加入span
					isSpan.innerHTML=`<span>${myTitles}</span>`
				}else if(isSpan.children.length==1){
					let mySpan=$(isSpan).find('span').first()
					if(1==mySpan.length&&(mySpan[0].outerText==''||mySpan[0].outerText=='null'||mySpan[0].outerText==null)){
						mySpan[0].outerText='-'
					}
				}
			}
		}

		function getSalaryList(id,form){
				$.ajax({
					type : "get",
					url : "/common/sysDict/getSalary",
					success : function(data) {
						$(id).empty();
						$(id).append($('<option>', {
							value: '',
							text: '请选择薪资'
						}))
						if (data.length > 0) {
							for(let i=0;i<data.length;i++){
								let item=data[i]
								$(id).append($('<option>', {
									value: item,
									text: item,
									selected: item == $(id).attr('myvalue')
								}))
							}
						}
						$(id).attr("disabled", $(id).prop('disabled'));
						form.render('select');
						selectInput($(id), 10)

					}
				});
		}


		setTimeout(()=>{
			let img1=$('img'),img2=$('image')
			const _setOnClick=(img,notimgCss=['closeUpload'],notSrc=['/img/pdf.png'],notalt=['上传成功后渲染'])=>{
				function _isClass(nodeClassName,classList){
					let result=true
					classList.forEach(item=>{
						if(nodeClassName.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				function _isSrc(nodeSrc,srcList){
					let result=true
					srcList.forEach(item=>{
						if(nodeSrc.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				function _isAlt(nodeAlt,altList){
					let result=true
					altList.forEach(item=>{
						if(nodeAlt.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				for (let i = 0; i < img.length; i++) {
					if($(img[i]).attr('onclick')!=''&& _isClass(img[i].className,notimgCss) && _isSrc(img[i].src,notSrc)&& _isAlt(img[i].alt,notalt)){
						$(img[i]).attr("onclick", "photosClick()");
					}
					//设置cus
				}
			}
			_setOnClick(img1)
			_setOnClick(img2)

		},300)

		function _debounce(func, wait) {
			let timeout;
			return function(...args) {
				clearTimeout(timeout);
				timeout = setTimeout(() => {
					func.apply(this, args);
				}, wait);
			};
		}
		var photosClick=()=>{
			let img1=$('img'),img2=$('image')
			let srcs=[],photoIndex=0
			function _getsrc(list,notimgCss=['closeUpload'],notSrc=['/img/pdf.png'],notalt=['上传成功后渲染']){
				function _isClass(nodeClassName,classList){
					let result=true
					classList.forEach(item=>{
						if(nodeClassName.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				function _isSrc(nodeSrc,srcList){
					let result=true
					srcList.forEach(item=>{
						if(nodeSrc.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				function _isAlt(nodeAlt,altList){
					let result=true
					altList.forEach(item=>{
						if(nodeAlt.indexOf(item)>-1){
							result=false
							return result
						}
					})
					return result
				}
				for (let i = 0; i < list.length; i++) {
					let item={
						src:list[i].src
					}
					if(srcs.filter(src=>src.src==item.src).length==0 && _isClass(list[i].className,notimgCss) && _isSrc(list[i].src,notSrc)&& _isAlt(list[i].alt,notalt)){
						item.url=item.src
						srcs.push(item)
					}
				}
			}
			_getsrc(img1)
			_getsrc(img2)
			for (let i = 0; i <srcs.length; i++) {
				if(srcs[i].src==event.srcElement.src){
					photoIndex=i;
				}
			}
			if(parent.showPhones){
				parent.showPhones(srcs,photoIndex)
				return false
			}
			if(parent.parent.showPhones){
				parent.parent.showPhones(srcs,photoIndex)
				return false
			}
			if(parent.parent.parent.showPhones){
				parent.parent.parent.showPhones(srcs,photoIndex)
				return false
			}
			// layui.use('layer', function(layer) {
			// 	layer.photos({
			// 		photos: {
			// 			title: event.srcElement.alt ? event.srcElement.alt : "预览", // 图片标题
			// 			data: srcs,
			// 			start: photoIndex,
			// 		},
			// 		anim: 5, // 图片预览的动画效果
			// 		//添加旋转按钮
			// 		tab: function () {
			// 			num = 0;
			// 		},
			// 		success: function () {
			// 			// let mouseX=0,mouseY=0
			// 			// $(document).on("mousemove", ".layui-layer-photos", function (ev) {
			// 			// 	mouseX=ev.clientX-$('.layui-layer-photos img')[0].x
			// 			// 	mouseY=ev.clientY-$('.layui-layer-photos img')[0].y
			// 			// })
			// 			//
			// 			// // let ratioDelta=1
			// 			// //以鼠标位置为中心的图片滚动放大缩小
			// 			// $(document).on("mousewheel", ".layui-layer-photos", function (ev) {
			// 			// 	// var oImg = this;
			// 			// 	// var ev = event || window.event;//返回WheelEvent
			// 			// 	// //ev.preventDefault();
			// 			// 	// var delta = ev.detail ? ev.detail > 0 : ev.wheelDelta < 0;
			// 			// 	// var ratioL = (ev.clientX - oImg.offsetLeft) / oImg.offsetWidth,
			// 			// 	// 		ratioT = (ev.clientY - oImg.offsetTop) / oImg.offsetHeight,
			// 			// 	// 		ratioDelta = !delta ? 1 + 0.1 : 1 - 0.1,
			// 			// 	// 		w = parseInt(oImg.offsetWidth * ratioDelta),
			// 			// 	// 		h = parseInt(oImg.offsetHeight * ratioDelta),
			// 			// 	// 		l = Math.round(ev.clientX - (w * ratioL)),
			// 			// 	// 		t = Math.round(ev.clientY - (h * ratioT));
			// 			// 	// //设置相册层宽高
			// 			// 	// $(".layui-layer-photos").css({ width: w, height: h, left: l, top: t });
			// 			// 	// //设置图片外div宽高
			// 			// 	// $("#layui-layer-photos").css({ width: w, height: h });
			// 			// 	// //设置图片宽高
			// 			// 	// $("#layui-layer-photos img").css({ width: w, height: h });
			// 			//
			// 			// 	const style = window.getComputedStyle($('.layui-layer-photos img')[0]);
			// 			// 	const transformMatrix = new WebKitCSSMatrix(style.getPropertyValue('transform'));
			// 			// 	const scaleValue = transformMatrix.a;
			// 			// 	const w=$('.layui-layer-photos img')[0].width,h=$('.layui-layer-photos img')[0].height
			// 			// 	const w1=w*scaleValue,h1=h*scaleValue
			// 			// 	let left=mouseX/scaleValue-mouseX,top= mouseY-mouseY/scaleValue
			// 			//
			// 			// 	console.log('left',left,top)
			// 			// 	// if(left>w1){
			// 			// 	// 	left=left>0?w1:-w1
			// 			// 	// }
			// 			// 	// if(top>h1){
			// 			// 	// 	top=top>0?h1:-h1
			// 			// 	// }
			// 			//
			// 			// 	$('.layui-layer-photos').css({ background: "transparent",
			// 			// 		width: 'auto',
			// 			// 		height:'auto'
			// 			// 	})
			// 			// 	// $('.layui-layer-photos img').css({
			// 			// 	// 	left:scaleValue<1?0:left,
			// 			// 	// 	top: scaleValue<1?0:top
			// 			// 	// })
			// 			// });
			// 			// //点击旋转按钮旋转图片
			// 			// // $(document).on("click", ".pootosIcon img", function (e) {
			// 			// // 	//+90为向右旋(顺时针)，-90为向左旋(逆时针)
			// 			// // 	num = (num + 90) % 360;
			// 			// // 	//旋转之后背景色设置为黑色，不然在旋转长方形图片时会留下白色空白
			// 			// // 	$("#layui-layer-photos").css('transform', 'rotate(' + num + 'deg)');
			// 			// // });
			// 			// $(document).on("click", "#layui-layer-photos .layui-icon-refresh-1", function (e) {
			// 			// 	$('.layui-layer-photos img').css({
			// 			// 		left: 0,
			// 			// 		top: 0
			// 			// 	})
			// 			// });
			// 		},
			// 	});
			// })
		}

		var myDownFiles=(URL)=>{
			var filename="文件.xls",myUrl =""
			$.ajax({
				url : URL,
				type: 'GET',
				xhrFields: {
					responseType: 'blob' // 设置响应类型为blob
				},
				complete:(jqXHR)=>{
					hindLoading()
					var disposition = jqXHR.getResponseHeader('Content-Disposition');
					if (disposition) {
						var filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
						var matches = filenameRegex.exec(disposition);
						if (matches != null && matches[1]) {
							filename = matches[1].replace(/['"]/g, '');
							filename =decodeURI(filename)
						}
					}
					if(myUrl==''){
						layer.msg('请求失败')
						return false
					}
					///下载
					var a = document.createElement("a");
					document.body.appendChild(a);
					a.href = myUrl;
					a.download = filename;
					a.click();
					window.URL.revokeObjectURL(myUrl);
					a.remove();
				},
				success : (blob)=> {
					myUrl = window.URL.createObjectURL(blob);

				}
			})
		}
	</script>
</div>
